﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetMVC.DTO;
using DotNetMVC.DTO.Enums;
using DotNetMVC.Model;

namespace DotNetMVC.IService
{
    public partial interface IAdminUserService : IBaseService<AdminUser>
    {
        #region 查询
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="options"></param>
        /// <param name="total"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        AdminUserDTO[] GetPagedData(AdminUserSearchOptions options, out long total, int pageIndex, int pageSize);

        /// <summary>
        /// 通过用户 Id 获取用户信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        AdminUserDTO GetDTOById(long userId);

        /// <summary>
        /// 通过用户名获取用户信息
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        AdminUserDTO GetByName(string userName);

        /// <summary>
        /// 用户名是否存在
        /// </summary>
        /// <param name="permName"></param>
        /// <returns></returns>
        bool Exist(string name);
        #endregion

        #region CUD
        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="PhoneNum"></param>
        /// <param name="Password"></param>
        /// <param name="Email"></param>
        /// <param name="CityId"></param>
        /// <returns></returns>
        long Add(string name, string password,string phoneNum,  string email);

        /// <summary>
        /// 编辑用户
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="phoneNum"></param>
        /// <param name="password"></param>
        /// <param name="email"></param>
        /// <param name="cityId"></param>
        void Update(long id, string password,string phoneNum, string email);

        /// <summary>
        /// 改变管理员账号状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="isEnable"></param>
        /// <returns></returns>
        bool ChangStatus(long id, bool isEnable); 
        #endregion

        #region 登录
        /// <summary>
        /// 验证登录
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        AdminLoginResult CheckLogin(string userName, string password);

        /// <summary>
        /// 用户登录成功
        /// </summary>
        /// <param name="userName"></param>
        void LoginSuccess(string userName);

        /// <summary>
        /// 用户登录失败
        /// </summary>
        /// <param name="userName"></param>
        int LoginError(string userName);

        /// <summary>
        /// 验证用户是否拥有权限
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="controllerName"></param>
        /// <param name="actionName"></param>
        /// <param name="httpMethod"></param>
        /// <returns></returns>
        bool HasPermission(long userId, string controllerName, string actionName, string httpMethod);
        #endregion
    }
}
